﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using ClassLibrary.DAO;
using ClassLibrary.Entity;
using ClassLibrary.Data;

public partial class Client_UserControl_ucViewItemImage : System.Web.UI.UserControl
{
    TblItemsDAO ItemsDAO = new TblItemsDAO(Global.CONNECTION_STRING);
    protected void Page_Load(object sender, EventArgs e)
    {
        string id = Request.QueryString["ID"];
        if(!IsPostBack)
            LoadImage(Convert.ToInt32(id));
    }

    private void LoadImage(int ItemID)
    {
        try
        {

            DataTable lstImg = ItemsDAO.GetImgItems(ItemID);
            lstItemImages.DataSource = lstImg;
            ListView1.DataSource = lstImg;
            lstItemImages.DataBind();
            ListView1.DataBind();
        }
        catch (Exception ex)
        {
            Session[Global.SESSION_ERROR] = ex;
            Response.Redirect(Global.ERROR_PAGE, true);
        }
    }
    protected void btnBack_Click(object sender, ImageClickEventArgs e)
    {
        Response.Redirect("~/ItemDetail.aspx?ID=" + Request.QueryString["ID"]);
    }
    
}
